﻿using System;
using System.Collections.Generic;

namespace Golos.Users.UserCache
{
    public partial class Cache
    {
        public Cache()
        {
            UpCache();
        }

        public bool UserExist(Guid userId)
        {
            lock (users)
            {
                return users.ContainsKey(userId);
            }
        }

        private void UpCache()
        {
            users = new Dictionary<Guid, UserInfo>();
            lock (users)
            {
                GetUserCacheFromDb();
            }
        }


        private Dictionary<Guid, UserInfo> users;
    }
}
